Auto merge of #3136 - alexcrichton:warn-bad-override, r=brson
authorbors <bors@rust-lang.org>
Thu, 6 Oct 2016 00:40:11 +0000 (17:40 -0700)
committerGitHub <noreply@github.com>
Thu, 6 Oct 2016 00:40:11 +0000 (17:40 -0700)
commita713da1867463a898b962a3f3e15ab407d8713ef
tree185dd28c394fe58e9e9bd05367fb5ae434cc666d
parent80d20e90d6666a8efed0224d9b3b82a6636da98d
parentfc0e64262a3c3b461f004d6fa75732ca656e73bd
Auto merge of #3136 - alexcrichton:warn-bad-override, r=brson

Warn about path overrides that won't work

Cargo has a long-standing [bug] in path overrides where they will cause spurious
rebuilds of crates in the crate graph. This can be very difficult to diagnose
and be incredibly frustrating as well. Unfortunately, though, it's behavior that
fundamentally can't be fixed in Cargo.

The crux of the problem happens when a `path` replacement changes something
about the list of dependencies of the crate that it's replacing. This alteration
to the list of dependencies *cannot be tracked by Cargo* as the lock file was
previously emitted. In the best case this ends up causing random recompiles. In
the worst case it cause infinite registry updates that always result in
recompiles.

A solution to this intention, changing the dependency graph of an overridden
dependency, was [implemented] with the `[replace]` feature in Cargo awhile back.
With that in mind, this commit implements a *warning* whenever a bad dependency
replacement is detected. The message here is pretty wordy, but it's intended to
convey that you should switch to using `[replace]` for a more robust
impelmentation, and it can also give security to anyone using `path` overrides
that if they get past this warning everything should work as intended.

[bug]: https://github.com/rust-lang/cargo/issues/2041
[implemented]: http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

Closes #2041
src/cargo/core/registry.rs
tests/overrides.rs